
<div class="row">
  <div class="span8">
    <div id="<*$controller*>">
      <link href="css/bootstrap-combined.min.css" rel="stylesheet">
      <link rel="stylesheet" type="text/css" media="screen" href="/css/bootstrap-datetimepicker.min.css">
      <script type="text/javascript" src="/js/DatePicker/WdatePicker.js" ></script> 
      <script type="text/javascript" src="/js/bootstrap-datetimepicker.min.js"></script>
      <style>
      .table tr td{ 
	         border:1px solid #dddddd;
	         text-align:center;
			 vertical-align: middle;
	              }
	    p .left{
		    text-align:left; 
		   }			  
   </style>
      <table class="table">
        <tr>
          <td colspan="3"><b>家长姓名</b></td>
          <td ><b>手机号</b></td>
          <td ><b>登录信息</b></td>
        </tr>
        <tr>
          <td colspan="3"><*$parents.realname*></td>
          <td><*$parents.mobile*></td>
          <td>账号：<*$parents.username*> 密码：<*$parents.password*></td>
        </tr>
        <tr>
          <td colspan="3"><b>孩子姓名</b></td>
          <td ><b>基本信息</b></td>
          <td ><b>所在机构</b></td>
        </tr>
        <*foreach from=$result item=a key =key name=foo*>
        <tr>
          <td colspan="3"><*$a.cnname*></td>
          <td  ><div  class="text-left"><i class="icon-star"></i> <*$a.nikename*> <br />
              <i class="icon-calendar"></i> <*$a.birthday*> <br />
              <i class="icon-user"></i> <*if $a.sex eq 1*>男<*else*>女<*/if*></div></td>
          <*eval var=$a.uid assign="uid"*> 
          <*if $student_unit|@count neq 0*>
          <td><*foreach from=$student_unit item=b key =key name=foo*>
            <div  class="text-left inline"> 
            <*if $a.uid eq $b.uid*>
              机构：<*$b.groupname*> <br />
              校区： <*$b.schoolname*> <br />
              班级 <*$b.classname*> <br />
              <a    role="button"  onclick="javascript:unbindcode(<*$a.uid*>,<*$b.uid_class*>,'<*$b.groupname_en*>',<*$a.pid*>)"  class="btn btn-primary">解除绑定</a> 
              <*else*> 
              <*/if*>  
              <*/foreach*>
              <form action="/<*$controller*>/bindstudent/" method="post" class="form-horizontal">
                绑定码：
                <input type="text" name="ma"  />
                </input>
                <input type="hidden" value="<*$a.uid*>" name="student_uid" />
                <input type="hidden" value="<*$a.pid*>" name="pid" />
                <button type="submit" class="btn  btn-primary " >绑定</button>
                <a   href="/bindcode/"  role="button"  class="btn ">查询绑定码</a>
                <a  onclick="javascript:deleteit(<*$a.uid*>,<*$a.pid*>)"  role="button"  class="btn inline">删除学生</a>
              </form>
            </div> 
            </td> 
          <*else*>
          <td  ><form action="/<*$controller*>/bindstudent/" method="post" class="form-horizontal">
              绑定码：
              <input type="text" name="ma"  />
              </input>
              <input type="hidden" value="<*$a.uid*>" name="student_uid" />
              <input type="hidden" value="<*$a.pid*>" name="pid" />
              <button type="submit" class="btn  btn-primary " >绑定</button>
              <a   href="/bindcode/"  role="button"  class="btn ">查询绑定码</a>
            </form></td>
          <*/if*>
            </td>
        </tr>
        <*/foreach*>
        <tr>
          <td colspan="5"><button type="button" class="btn  btn-primary " id="addform">添加孩子</button></td>
        </tr>
      </table>
      <div id="div" style="display:none;">
        <form action="/<*$controller*>/addop" method="post" class="form-horizontal">
          <input type="hidden" value="<*$parents.pid*>" name="id" />
          <input type="hidden" value="<*$page*>" name="page" />
          <input type="hidden" value="<*$parents.mobile*>" name="mobile">
          <input type="hidden" value="<*$parents.realname*>" name="realname">
          <div  id="studentlist"> </div>
          <input type="hidden"   id="hidd" value="1" />
          <div class="control-group">
            <div class="controls">
              <button type="submit" id="submit" class="btn btn-primary btn-large" >保存新增</button>
              &nbsp;&nbsp; </div>
          </div>
        </form>
      </div>
      <button type="button" class="btn   btn-block  btn-large" onclick="window.location='/<*$controller*>/parents/page/<*$page*>'">返回</button>
      <script type="text/javascript">
  var i=0;
  $(function() {
    $('#datetimepicker').datetimepicker({
      pickTime: false
    });
  });
    $(function() {
    $('#datetimepicker2').datetimepicker({
      pickTime: false
    });
  });  
  function checkMobile(){
     
    var reg =/^((\+86)|(86))?(1)\d{10}$/;
	 var mob = document.getElementById("mobile").value;
	 if(!mob.match(reg))
	 {
		 alert("请输入正确有效的手机号码！");
			return false;
	 } 
  }

 	   $(function(){  
			 $('#addform').click(function(){ 
			    document.getElementById("div").style.display="";
			 	    i=i+1; 
				   var str='<div class="control-group"><label class="control-label" for="<*$key*>">学生名称</label><div class="controls"><input type="text" name="cnname['+i+']" value="" class="input-xlarge" id="cnname" placeholder="输入孩子名称" /></div></div><div class="control-group"><label class="control-label" for="生日">生日</label><div class="controls" ><div class="input-append"   >';
				   str+='<input type="text" name="birthday['+i+']" onclick="WdatePicker({dateFmt:\'yyyy-MM-dd\'})"></input>';
				   
				   str+='<span class="add-on"><i data-time-icon="icon-time" class="icon-calendar"></i></span></div></div></div><div class="control-group"><label class="control-label" for="<*$key*>">性别</label><div class="controls"><label class="radio inline"><input type="radio" name="sex'+i+'" id="boy" value="1"> 男</label><label class="radio inline"><input type="radio" name="sex'+i+'" id="girls" value="2"> 女</label></div></div>';
				$("#studentlist").append(str);
			});  
	  });
function unbindcode(student_uid,uid_class,enname,pid){  
  window.location='/<*$controller*>/unbindcode/student_uid/'+student_uid+'/uid_class/'+uid_class+'/enname/'+enname+'/pid/'+pid;
  } 
 function deleteit(uid,pid)
	{  
	  if(confirm("删除将不能恢复")){
	   window.location='/<*$controller*>/deletestudent/uid/'+uid+'/pid/'+pid;
	   }
	}   
</script> 
    </div>
  </div>
</div>
